package com.noahplat.alarm.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 功能：报警信息实体类
 * name:宋彦磊
 * time:2021.03.15
 */
@Data
@Table(name = "tb_alarm")
public class Alarm {

    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;          //主键ID
    @Id
    private Long pid;       //账套ID
    @Id
    private Long acctid;       //账套ID
    @Id
    private Long uid;          //用户ID
    @NotNull(message = "设备唯一标识不能为空")
    @Length(max = 20, message = "长度不能超过20位")
    private String imei;        //设备唯一标识
    @NotNull(message = "报警信息不能为空")
    @Length(max = 1000, message = "长度不能超过1000位")
    private String alarm;        //报警信息
    @NotNull(message = "消息类型不能为空")
    @Length(max = 20, message = "长度不能超过20位")
    private String type;        //消息类型
    @NotNull(message = "处理人不能为空")
    @Length(max = 20, message = "长度不能超过20位")
    private String user;        //处理人
    @NotNull(message = "状态不能为空")
    @Length(max = 1, message = "长度不能超过1位")
    private String state;        //状态 0.未读 1.已读未处理 2.已处理
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date addtime;        //登记时间

    @Transient
    private String name; //消息关联人员
    @Transient
    private Long payuid; //操作人ID
}
